<extend name="desktop_default/template/user/base_user" />
<block name="area_header">
    <link rel="stylesheet" href="__CSS__/user/focus/style.css">
</block>

<block name="area_top">

</block>
<block name="user_top">

</block>
<block name="main_content">
    <div class="focus">
        <div class="user-tab">
            <a class="selected" href="{:U('mengwu/user/focus')}">我的关注</a>
        </div>
        <empty name="list">
            <div class="empty-list">没有任何粉丝哦~</div>
            <else/>
            <div class="fflist">
                <volist name="list" id="vo">
                    <div class="item">
                        <div class="head">
                            <img src="{$vo.head}">
                        </div>
                        <div class="info">
                            <div class="name"><a href="javascript:void(0);">{$vo.nickname}</a></div>
                            <div class="guanzhu"><i class="iconfont icon-check"></i>已关注</div>
                            <div class="brief">简介：{$vo.sign}</div>
                            <div class="quxiao">
                                <switch name="vo.is_focus_back">
                                    <case value="0">
                                        <a class="btn-focus" data-uid="{$vo.uid}" href="javascript:void(0);"><i class="iconfont icon-plus"></i>关注</a>
                                    </case>
                                    <case value="1">
                                        <a class="btn-focused" data-uid="{$vo.uid}" href="javascript:void(0);"><i class="iconfont icon-cross"></i>取消关注</a>
                                    </case>
                                    <default />
                                </switch>
                            </div>
                        </div>
                    </div>
                </volist>
            </div>
        </empty>
        {$show}
    </div>

</block>
<block name="area_footer">
    <script type="text/javascript">
        function focus(f,uid){
            var data = {
                focus_uid : uid,
                value : f ? 1 :0
            };
            var url = getBaseUrl() + '/mengwu/mengwuApi/user_focus';

            _post(url,jQuery.param(data),{data_back: function(data){
                if(data.status){
                    antd.message.success('操作成功！');
                    setTimeout(function(){window.location.reload()},500);
                }else{
                    if(typeof data.info.redirect !="undefined"){
                        antd.message.error(data.info.info);
                        setTimeout(function(){
                            window.location.href = data.info.redirect;
                        },1000);
                    }else{
                        antd.message.error('操作失败！');
                    }
                }
            }});
        }
        $('.btn-focus').click(function(){
            var uid = $(this).attr('data-uid');
            focus(true,uid);
        });
        $('.btn-focused').click(function(){
            var uid = $(this).attr('data-uid');
            focus(false,uid);
        });
    </script>
</block>
